home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
PASCAL
/
H442.ZIP
/
DEMOS.LZH
/
PAGEPRNT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-12-01
|
39KB
|
840 lines
{*****************************************************************************}
{*FILE:PAGEPRNT.PAS, A printer set up utility, intended mainly for the *}
{*Panasonic KX-P1081 dot matrix printer, but will also set up many other IBM *}
{*and Epson compatible printers, using graphic and text modes. *}
{*This version may only be used from the command line as it uses dos input *}
{*/output routines and thus cannot be made memory resident, It does however *}
{*contain a complete print spooler as a bonus. see manual for user instruct. *}
{*The memory resident version called PRINTER.PAS does not have the print *}
{*spooler facility. *}
{*PAGEPRNT.PAS V1.5b (c)1993 (01/12/93) (MAIN FILE) *}
{*PAGEPRNT.PFS V1.5b (c)1993 (01/12/93) (PRINT SPOOLER ROUTINES ONLY) *}
{*****************************************************************************}
program PAGEPRNT;
{******}
{*USES*}
{******}
uses crt,dos,printer,winmen;
{******************}
{*TYPE DEFINITIONS*}
{******************}
type
option = record
yes : boolean;
num : byte;
end;
PathStr = string[79];
DirStr = string[67];
NameStr = string[8];
ExtStr = string[4];
{*****************************}
{*GLOBAL VARIABLE DEFINITIONS*}
{*****************************}
var
inthandler : pointer;
regs : registers;
menu_main,menu_char1,menu_set,menu_mode,menu_comb,menu_pitch,menu_linesp,
menu_char2,menu_pfeed,menu_pgfrmt,menu_wproc,menu_datacon,menu_misc,
menu_print,menu_flist,
hello,error,setings,input,printing,layout,plen,
n,n1,actionX,actionY,ncopies,fncopies,loop1,loop2,t,b : byte;
m1c,m2c,m3c,m4c,m5c,m6c,m7c,m8c,m9c,m10c,m11c,m12c,m13c,m14c,m15c,
index,shour,smin,ssec,s100sec,syear,smonth,sday,sdow,count,files,
textattr_safe : word;
errpos,linenum,pagenum : integer;
f : datetime;
mt,mtc,list : pt_mtext;
scr,infile : text;
line : string[81];
strn,strn1 : string[15];
copies,fcopies : string[2];
ans,colotog : char;
dpfname : pathstr;
dpname : dirstr;
name : namestr;
ext : extstr;
fname,fdate,ftime,fsize,sdate,stime,pgnum,pbreak,quick,Icopies : boolean;
opt : array[1..400] of option;
fspec : searchrec;
{***************}
{*INCLUDE FILES*}
{***************}
{$I \TP6\PAS\WM1_5\PAGEPRNT.PFS} {*PRINT SPOOLER ROUTINES FILE*}
{**************************************************************************}
{*PROCEDURE:SEND_TO_PRN, This procedure sends a series of bytes to the std*}
{*printer (parallel) device, the number of bytes is defined in "num", the *}
{*actual values are placed in "v1,v2,v3,v4,v5", any values not used should*}
{*be sent as zero, the bytes are sent via the IBM PC rom bios printer *}
{*controler services intr 17H (23) function 00H (0), write character to *}
{*printer. This method is used because all msdos services are out of *}
{*bounds to memory resident programmes, this includes all Turbo Pascal *}
{*input/output routines and most dynamic memory allocation routines, *}
{*although the WINMEN unit, which this programme uses for its windows and *}
{*menus does not appear to be affected!. The procedure also checks for *}
{*errors on the printer line and produces an error message if one is found*}
{**************************************************************************}
procedure SEND_TO_PRN(num,v1,v2,v3,v4,v5 : byte; action : string);
begin
index := ofs(v1); {*ADDR OF TOP OF STACK*}
for count := 1 to num do {*LOOP THRO NUM TIMES*}
begin
regs.AH := 2; {*GET PRINTER STATUS*}
regs.DX := 0; {*PRINTER NUMBER*}
intr($17,regs); {*CALL ROM BIOS PCS*}
if(regs.AH in[1,8,32]) then {*IF AN ERROR OCCURED*}
begin {*LET USER KNOW *}
WOPEN(error);
writeln(scr,chr(7),'Error Printer could be:-');
writeln(scr,'Off line.');
writeln(scr,'Out of paper or');
writeln(scr,'There is an I/O error.');
write(scr,'Press any key To Continue.....');
while not(keypressed) do;
WMCLOSE(error);
exit;
end
else {*ELSE WERE OK TO SEND*}
begin
regs.AH := 0; {*WRITE CHAR TO PRINTER*}
regs.AL := mem[seg(v1):index]; {*CHAR TO BE WRITTEN*}
regs.DX := 0; {*PRINTER NUMBER*}
intr($17,regs); {*CALL ROM BIOS PCS*}
dec(index,2); {*DEC STACK POINTER TO*}
end; {*NEXT VALUE *}
end;
WSELECT(setings); {*SELECT OUTPUT WINDOW*}
gotoXY(actionX,actionY); {*POSITION CURSOR*}
if(pos('RESET',action) <> 0) then {*IF A RESET BEEN SENT*}
begin {*CLEAR OUTPUT WINDOW *}
WCLRSCR(setings);
actionX := 1;
actionY := 1;
end;
write(scr,action,' '); {*PRINT COMMAND*}
actionX := whereX; {*SAVE LOCAL CURSOR POS*}
actionY := whereY;
end {SEND_TO_PRN};
{*****************************************************************************}
{*PROCEDURE:MISC_COMS, This procedure displays all the remaining commands not*}
{*covered in any other menu/procedure and sets the printer accordingly. *}
{*****************************************************************************}
procedure MISC_COMS;
begin
m13c := 10;
WMTITLE(menu_misc,4,14,'MISCELLANEOUS COMMANDS MENU');
while not(m13c in[0]) do
begin
m13c := POP_MENU(menu_misc,33,1);
case m13c of
1 : SEND_TO_PRN(2,27,64,0,0,0,'RESET'); {*ESC+@ *}
2 : SEND_TO_PRN(1,13,0,0,0,0,'PRINT'); {*CR *}
3 : SEND_TO_PRN(1,27,0,0,0,0,'ESC'); {*ESC *}
4 : SEND_TO_PRN(1,0,0,0,0,0,'NULL'); {*NULL *}
5 : SEND_TO_PRN(2,27,60,0,0,0,'HOME_HEAD');{*ESC+< *}
6 : SEND_TO_PRN(3,27,115,1,0,0,'HALF_SP'); {*ESC+s+1*}
7 : SEND_TO_PRN(3,27,115,0,0,0,'RHALF_SP');{*ESC+s+0*}
8 : SEND_TO_PRN(3,27,85,1,0,0,'SING_DIR'); {*ESC+U+1*}
9 : SEND_TO_PRN(3,27,85,0,0,0,'RSING_DIR');{*ESC+U+0*}
10 : SEND_TO_PRN(2,27,9,0,0,0,'ENAB_PE'); {*ESC+9 *}
11 : SEND_TO_PRN(2,27,8,0,0,0,'DISAB_PE'); {*ESC+8 *}
end {case};
end {while};
end {MISC_COMS};
{*****************************************************************************}
{*PROCEDURE:DATA_CON_COMS, This procedure displays all the data control comms*}
{*available and sets the printer accordingly. *}
{*****************************************************************************}
procedure DATA_CON_COMS;
begin
m12c := 10;
WMTITLE(menu_datacon,4,14,'DATA CONTROL COMMANDS MENU');
while not(m12c in[0]) do
begin
m12c := POP_MENU(menu_datacon,25,1);
case m12c of
1 : SEND_TO_PRN(2,27,64,0,0,0,'RESET'); {*ESC+@ *}
2 : SEND_TO_PRN(1,24,0,0,0,0,'CLEAR_BUFFER'); {*CAN *}
3 : SEND_TO_PRN(1,127,0,0,0,0,'DEL_CHAR'); {*DEL *}
4 : SEND_TO_PRN(1,17,0,0,0,0,'SEL_PRNTR'); {*DC1 *}
5 : SEND_TO_PRN(1,19,0,0,0,0,'DESEL_PRNTR'); {*DC3 *}
6 : SEND_TO_PRN(2,27,62,0,0,0,'MSB_ON'); {*ESC+> *}
7 : SEND_TO_PRN(2,27,61,0,0,0,'MSB_OFF'); {*ESC+= *}
8 : SEND_TO_PRN(2,27,35,0,0,0,'MSB_AS_IS'); {*ESC+# *}
9 : SEND_TO_PRN(3,27,81,3,0,0,'DESEL_PRNTR_IBM');{*ESC+Q+3*}
end {case};
end {while};
end {DATA_CON_COMS};
{*************************************************************************}
{*PROCEDURE:WD_PROC_COMS, This procedure displays all the word processing*}
{*commands available and sets the printer accordingly. *}
{*************************************************************************}
procedure WD_PROC_COMS;
begin
m11c := 10;
WMTITLE(menu_wproc,4,14,'WORD PROCESSING COMMANDS MENU');
while not(m11c in[0]) do
begin
m11c := POP_MENU(menu_wproc,19,1);
case m11c of
1 : SEND_TO_PRN(2,27,64,0,0,0,'RESET'); {*ESC+@ *}
2 : SEND_TO_PRN(3,27,97,0,0,0,'LEFT_ALIGN'); {*ESC+a+0*}
3 : SEND_TO_PRN(3,27,97,1,0,0,'AUTO_CNTR'); {*ESC+a+1*}
4 : SEND_TO_PRN(3,27,97,2,0,0,'RIGHT_ALIGN');{*ESC+a+2*}
5 : SEND_TO_PRN(3,27,97,3,0,0,'AUTO_JUSTIF');{*ESC+a+3*}
end {case};
end {while};
end {WD_PROC_COMS};
{*************************************************************************}
{*PROCEDURE:PG_FORMAT_COMS, This procedure displays all the page format *}
{*commands and sets the printer accordingly. Also asks the user for input*}
{*for those commands that require it. *}
{*************************************************************************}
procedure PG_FORMAT_COMS;
begin
m10c := 20;
WMTITLE(menu_pgfrmt,4,14,'PAGE FORMAT COMMANDS MENU');
while not(m10c in[0]) do
begin
m10c := POP_MENU(menu_pgfrmt,13,1);
case m10c of {*GET USER INPUT*}
7,
10..16 : begin
input := NEW_WIN(14,m10c+2,38,m10c+4,4,4,14,1,14);
WOPEN(input);
WMTITLE(input,7,12,'PAGE FORMAT');
n := 150;
while not(n in[0..137]) do
begin
write(scr,chr(10),'Input n:');
readln(n); {*INPUT VALUE n*}
end;
WMDELETE(input);
str(n,strn);
end;
5,8 : begin
input := NEW_WIN(14,m10c+2,48,m10c+4,4,4,14,1,14);
WOPEN(input);
WMTITLE(input,7,12,'PAGE FORMAT');
n := 100; n1 := 100;
while not(n in[0..80])or(n1 < n)or not(n1 in[0..80]) do
begin
write(scr,chr(10),'Input (n1<n2)<0..80>:');
readln(n,n1); {*INPUT VALUES n n1 *}
end; {*MUST BE A SPACE IN*}
WMDELETE(input); {*BETWEEN VALUES *}
str(n,strn); str(n1,strn1);
end;
end {case};
case m10c of {*BUILD COMMAND STRINGS*}
5 : strn := 'HT_'+strn+'_'+strn1;
7 : strn := 'HTE'+strn;
8 : strn := 'VT_'+strn+'_'+strn1;
10 : strn := 'VTE'+strn;
11 : strn := 'PLIN'+strn;
12 : begin
plen := n;
strn := 'PLL'+strn;
end;
13 : strn := 'LM'+strn;
14 : strn := 'RM'+strn;
15 : strn := 'SKPOS'+strn;
16 : strn := 'SKL'+strn;
end {case};
case m10c of
1 : SEND_TO_PRN(2,27,64,0,0,0,'RESET'); {*ESC+@ *}
2 : SEND_TO_PRN(1,27,0,0,0,0,'BS'); {*BS *}
3 : SEND_TO_PRN(1,27,0,0,0,0,'HT'); {*HT *}
4 : SEND_TO_PRN(1,27,0,0,0,0,'VT'); {*VT *}
5 : SEND_TO_PRN(5,27,65,n,n1,0,strn); {*ESC+D+n1+n2+0*}
6 : SEND_TO_PRN(3,27,68,0,0,0,'RHORZ'); {*ESC+D+0 *}
7 : SEND_TO_PRN(4,27,101,0,n,0,strn); {*ESC+e+0+n *}
8 : SEND_TO_PRN(5,27,66,n,n1,0,strn); {*ESC+B+n1+n2+0*}
9 : SEND_TO_PRN(3,27,66,0,0,0,'RVERT'); {*ESC+B+0 *}
10 : SEND_TO_PRN(4,27,101,1,n,0,strn); {*ESC+e+1+n *}
11 : SEND_TO_PRN(4,27,67,0,n,0,strn); {*ESC+C+0+n *}
12 : SEND_TO_PRN(3,27,67,n,0,0,strn); {*ESC+C+n *}
13 : SEND_TO_PRN(3,27,108,n,0,0,strn); {*ESC+l+n *}
14 : SEND_TO_PRN(3,27,81,n,0,0,strn); {*ESC+Q+n *}
15 : SEND_TO_PRN(4,27,102,0,n,0,strn); {*ESC+f+0+n *}
16 : SEND_TO_PRN(4,27,102,1,n,0,strn); {*ESC+f+1+n *}
end {case};
end {while};
end {PG_FORMAT_COMS};
{*********************************************************************}
{*PROCEDURE:PAP_FEED_COMS, This procedure displays all the paper feed*}
{*commands and sets the printer accordingly. Also asks the user for *}
{*input for thoes commande thet require it *}
{*********************************************************************}
procedure PAP_FEED_COMS;
begin
m9c := 10;
WMTITLE(menu_pfeed,4,14,'PAPER FEED COMMANDS MENU');
while not(m9c in[0]) do
begin
m9c := POP_MENU(menu_pfeed,8,1);
case m9c of
1 : SEND_TO_PRN(2,27,64,0,0,0,'RESET'); {*ESC+@ *}
2 : SEND_TO_PRN(1,12,0,0,0,0,'FF'); {*FF *}
3 : SEND_TO_PRN(1,10,0,0,0,0,'LF'); {*LF *}
4 : begin
input := NEW_WIN(9,m9c+2,33,m9c+4,4,4,14,1,14);
WOPEN(input);
WMTITLE(input,7,12,'LINES TO SKIP');
n := 150;
while not(n in[1..127]) do
begin
write(scr,chr(10),'Input n<1..127>:');
readln(n); {*INPUT VALUE n*}
end;
WMDELETE(input);
str(n,strn);
strn := 'SKIP'+strn;
SEND_TO_PRN(3,27,78,n,0,0,strn); {*ESC+N+n*}
end;
5 : SEND_TO_PRN(2,27,79,0,0,0,'RSKIP'); {*ESC+O *}
end {case};
end {while};
end {PAP_FEED_COMS};
{*************************************************************************}
{*PROCEDURE:LINE_SPC_COMS, This procedure displays all the line spacing *}
{*commands and sets the printer accordingly. Also asks the user for input*}
{*for those commands that require it. *}
{*************************************************************************}
procedure LINE_SPC_COMS;
begin
m7c := 10;
WMTITLE(menu_linesp,4,14,'LINE SPACING MENU');
while not(m7c in[0]) do
begin
m7c := POP_MENU(menu_linesp,1,1);
case m7c of
5 : begin
input := NEW_WIN(2,m7c+2,26,m7c+4,4,4,14,1,14);
WOPEN(input);
WMTITLE(input,7,12,'LINE SPACING');
n := 100;
while not(n in[0..85]) do
begin
write(scr,chr(10),'Input n<0..85>:');
readln(n); {*INPUT VALUE n*}
end;
WMDELETE(input);
str(n,strn);
strn := 'LS'+strn+'/72';
end;
6,7 : begin
input := NEW_WIN(2,m7c+2,26,m7c+4,4,4,14,1,14);
WOPEN(input);
WMTITLE(input,7,12,'LINE SPACING');
write(scr,chr(10),'Input n<0..255>:');
readln(n); {*INPUT VALUE n*}
WMDELETE(input);
str(n,strn);
strn := 'LS'+strn+'/216';
end;
end {case};
case m7c of
1 : SEND_TO_PRN(2,27,64,0,0,0,'RESET'); {*ESC+@ *}
2 : SEND_TO_PRN(2,27,48,0,0,0,'LS1/8"'); {*ESC+O *}
3 : SEND_TO_PRN(2,27,1,1,0,0,'LS7/72"'); {*ESC+1 *}
4 : SEND_TO_PRN(2,27,2,2,0,0,'LS1/6"'); {*ESC+2 *}
5 : SEND_TO_PRN(3,27,65,n,0,0,strn); {*ESC+A+n/72 *}
6 : SEND_TO_PRN(3,27,51,n,0,0,strn); {*ESC+3+n/216*}
7 : SEND_TO_PRN(3,27,74,n,0,0,strn); {*ESC+J+n/216*}
end {case};
end {while};
end {LINE_SPC_COMS};
{****************************************************************************}
{*PROCEDURE:SEL_CHAR_PITCH, This procedure displays the available characters*}
{*per inch setings and sets the printer according to selection. *}
{****************************************************************************}
procedure SEL_CHAR_PITCH;
begin
m6c := 10;
WMTITLE(menu_pitch,4,14,'CHARACTER PITCH MENU');
while not(m6c in[0]) do
begin
m6c := POP_MENU(menu_pitch,53,3);
case m6c of
1 : SEND_TO_PRN(2,27,64,0,0,0,'RESET'); {*ESC+@ *}
2 : SEND_TO_PRN(3,27,119,0,0,0,'10CPI'); {*ESC+w+0 *}
3 : SEND_TO_PRN(3,27,119,1,0,0,'12CPI'); {*ESC+w+1 *}
4 : SEND_TO_PRN(3,27,119,2,0,0,'15CPI'); {*ESC+w+2 *}
5 : SEND_TO_PRN(3,27,119,3,0,0,'17CPI'); {*ESC+w+3 *}
end {case};
end {while};
end {SEL_CHAR_PITCH};
{**********************************************************************}
{*PROCEDURE:SEL_MODE_COMB, This procedure displays the character mode *}
{*combinations available directly through preset multi-byte commands *}
{*and sets the printer according to selection. *}
{**********************************************************************}
procedure SEL_MODE_COMB;
begin
m5c := 30;
WMTITLE(menu_comb,4,14,'CHAR MODE COMBIN MENU '+chr(24)+chr(25));
while not(m5c in[0]) do
begin
m5c := LIST_MENU(menu_comb,49,3,10);
case m5c of
1 : SEND_TO_PRN(5,27,64,27,33,0,'RESET'); {E@E!+0 }
2 : SEND_TO_PRN(5,27,64,27,33,1,'RESET+ELITE'); {E@E!+1 }
3 : SEND_TO_PRN(5,27,64,27,33,4,'RESET+COMPRESSED'); {E@E!+4 }
4 : SEND_TO_PRN(5,27,64,27,33,8,'RESET+EMPHASIZED'); {E@E!+8 }
5 : SEND_TO_PRN(5,27,64,27,33,9,'RESET+ELITE+EMPH'); {E@E!+9 }
6 : SEND_TO_PRN(5,27,64,27,33,16,'RESET+DOUBLE'); {E@E!+16}
7 : SEND_TO_PRN(5,27,64,27,33,17,'RESET+ELITE+DOUBLE'); {E@E!+17}
8 : SEND_TO_PRN(5,27,64,27,33,20,'RESET+COMP+DOUBLE'); {E@E!+20}
9 : SEND_TO_PRN(5,27,64,27,33,24,'RESET+EMPH+DOUBLE'); {E@E!+24}
10 : SEND_TO_PRN(5,27,64,27,33,25,'RESET+ELITE+EMPH+DOUBLE');{E@E!+25}
11 : SEND_TO_PRN(5,27,64,27,33,32,'RESET+2WID'); {E@E!+32}
12 : SEND_TO_PRN(5,27,64,27,33,33,'RESET+ELITE+2WID'); {E@E!+33}
13 : SEND_TO_PRN(5,27,64,27,33,36,'RESET+COMP+2WID'); {E@E!+36}
14 : SEND_TO_PRN(5,27,64,27,33,40,'RESET+EMPH+2WID'); {E@E!+40}
15 : SEND_TO_PRN(5,27,64,27,33,41,'RESET+ELITE+EMPH+2WID'); {E@E!+41}
16 : SEND_TO_PRN(5,27,64,27,33,48,'RESET+DOUBLE+2WID'); {E@E!+48}
17 : SEND_TO_PRN(5,27,64,27,33,49,'RESET+ELITE+DOUBLE+2WID');{E@E!+49}
18 : SEND_TO_PRN(5,27,64,27,33,52,'RESET+COMP+DOUBLE+2WID'); {E@E!+52}
19 : SEND_TO_PRN(5,27,64,27,33,56,'RESET+EMPH+DOUBLE+2WID'); {E@E!+56}
20 : SEND_TO_PRN(5,27,64,27,33,57,'RESET+ELITE+EMPH+DOUBLE+2WID');
end {case}; {E@E!+57}
end {while};
end {SEL_MODE_COMB};
{***************************************************************************}
{*PROCEDURE:SEL_PRN_MODE, This procedure displays the printer mode commands*}
{*and sets the printer according to selection. *}
{***************************************************************************}
procedure SEL_PRN_MODE;
begin
m4c := 10;
WMTITLE(menu_mode,4,14,'PRINTER MODE MENU');
while not(m4c in[0]) do
begin
m4c := POP_MENU(menu_mode,32,3);
case m4c of
1 : SEND_TO_PRN(2,27,64,0,0,0,'RESET'); {*ESC+@ *}
2 : SEND_TO_PRN(3,27,109,0,0,0,'STANDARD'); {*ESC+m+0 *}
3 : SEND_TO_PRN(3,27,109,1,0,0,'IBM_MATRIX');{*ESC+m+1 *}
4 : SEND_TO_PRN(3,27,109,2,0,0,'IBM_GR1'); {*ESC+m+2 *}
5 : SEND_TO_PRN(3,27,109,3,0,0,'IBM_GR2'); {*ESC+m+3 *}
end {case};
end {while};
end {SEL_PRN_MODE};
{*****************************************************************************}
{*PROCEDURE:SEL_CHAR_SET, This procedure displays the international character*}
{*set commands and sets the printer according to selection. *}
{*****************************************************************************}
procedure SEL_CHAR_SET;
begin
m3c := 20;
WMTITLE(menu_set,4,14,'CHARACTER SET MENU');
while not(m3c in[0]) do
begin
m3c := POP_MENU(menu_set,19,3);
case m3c of
1 : SEND_TO_PRN(2,27,64,0,0,0,'RESET'); {*ESC+@ *}
2 : SEND_TO_PRN(3,27,82,0,0,0,'USA'); {*ESC+R+0 *}
3 : SEND_TO_PRN(3,27,82,1,0,0,'FRA'); {*ESC+R+1 *}
4 : SEND_TO_PRN(3,27,82,3,0,0,'ENG'); {*ESC+R+3 *}
5 : SEND_TO_PRN(3,27,82,4,0,0,'DEN1'); {*ESC+R+4 *}
6 : SEND_TO_PRN(3,27,82,10,0,0,'DEN2'); {*ESC+R+10*}
7 : SEND_TO_PRN(3,27,82,5,0,0,'SWE'); {*ESC+R+5 *}
8 : SEND_TO_PRN(3,27,82,6,0,0,'ITALY'); {*ESC+R+6 *}
9 : SEND_TO_PRN(3,27,82,7,0,0,'SPAIN'); {*ESC+R+7 *}
10 : SEND_TO_PRN(3,27,82,8,0,0,'JAP'); {*ESC+R+8 *}
11 : SEND_TO_PRN(3,27,82,9,0,0,'NOR'); {*ESC+R+9 *}
end {case};
end {while};
end {SEL_CHAR_SET};
{**********************************************************************}
{*PROCEDURE:SEL_CHAR_MODE, This procedure displays the Character mode *}
{*commands and sets the printer according to selection *}
{**********************************************************************}
procedure SEL_CHAR_MODE;
begin
m2c := 40;
WMTITLE(menu_char2,4,14,'CHAR MODE COMMANDS MENU '+chr(24)+chr(25));
while not(m2c in[0]) do
begin
m2c := LIST_MENU(menu_char2,5,3,10);
case m2c of
1 : SEND_TO_PRN(2,27,64,0,0,0,'RESET'); {*ESC+@ *}
2 : SEND_TO_PRN(1,14,0,0,0,0,'2WID1'); {*SO *}
3 : SEND_TO_PRN(2,27,14,0,0,0,'2WID1'); {*ESC+SO *}
4 : SEND_TO_PRN(1,20,0,0,0,0,'R2WID1'); {*DC4 *}
5 : SEND_TO_PRN(3,27,87,1,0,0,'2WID'); {*ESC+W+1*}
6 : SEND_TO_PRN(3,27,87,0,0,0,'RALL2WID'); {*ESC+W+0*}
7 : SEND_TO_PRN(1,15,0,0,0,0,'COMP1'); {*SI *}
8 : SEND_TO_PRN(2,27,15,0,0,0,'COMP2'); {*ESC+SI *}
9 : SEND_TO_PRN(1,18,0,0,0,0,'RCOMP'); {*DC2 *}
10 : SEND_TO_PRN(2,27,71,0,0,0,'DOUBLE'); {*ESC+G *}
11 : SEND_TO_PRN(2,27,72,0,0,0,'RDOUBLE'); {*ESC+H *}
12 : SEND_TO_PRN(2,27,69,0,0,0,'EMPH'); {*ESC+E *}
13 : SEND_TO_PRN(2,27,70,0,0,0,'REMPH'); {*ESC+F *}
14 : SEND_TO_PRN(2,27,80,0,0,0,'PICA'); {*ESC+P *}
15 : SEND_TO_PRN(2,27,77,0,0,0,'ELITE'); {*ESC+M *}
16 : SEND_TO_PRN(2,27,58,0,0,0,'ELIBM'); {*ESC+: *}
17 : SEND_TO_PRN(2,27,110,0,0,0,'NLQPIC'); {*ESC+n *}
18 : SEND_TO_PRN(2,27,111,0,0,0,'NLQELI'); {*ESC+o *}
19 : SEND_TO_PRN(3,27,120,1,0,0,'NLQFON'); {*ESC+x+1*}
20 : SEND_TO_PRN(3,27,120,0,0,0,'DRAFON'); {*ESC+x+0*}
21 : SEND_TO_PRN(3,27,83,0,0,0,'SUPSCR'); {*ESC+S+0*}
22 : SEND_TO_PRN(3,27,83,1,0,0,'SUBSCR'); {*ESC+S+1*}
23 : SEND_TO_PRN(2,27,84,0,0,0,'RSUPSUB'); {*ESC+T *}
24 : SEND_TO_PRN(2,27,52,0,0,0,'ITALIC'); {*ESC+4 *}
25 : SEND_TO_PRN(2,27,53,0,0,0,'RITALIC'); {*ESC+5 *}
26 : SEND_TO_PRN(2,27,54,0,0,0,'ITALSTD'); {*ESC+6 *}
27 : SEND_TO_PRN(2,27,55,0,0,0,'RITALSTD'); {*ESC+7 *}
28 : SEND_TO_PRN(2,27,55,0,0,0,'IBMGRM1'); {*ESC+6 *}
29 : SEND_TO_PRN(2,27,54,0,0,0,'IBMGR2'); {*ESC+7 *}
30 : SEND_TO_PRN(3,27,45,1,0,0,'ULINE'); {*ESC+-+1*}
31 : SEND_TO_PRN(3,27,45,0,0,0,'RULINE'); {*ESC+-+0*}
32 : SEND_TO_PRN(3,27,112,1,0,0,'PROP'); {*ESC+p+1*}
33 : SEND_TO_PRN(3,27,112,0,0,0,'RPROP'); {*ESC+p+0*}
end {case};
end {while};
end {SEL_CHAR_MODE};
{****************************************************************************}
{*PROCEDURE:CHAR_MODE_COMS, This procedure displays the bar menu which gives*}
{*access to all the character mode command list and pop menus *}
{****************************************************************************}
procedure CHAR_MODE_COMS;
begin
m8c := 10;
while not(m8c in[0]) do
begin
m8c := BAR_MENU(menu_char1,1,1,80);
case m8c of
1 : SEL_CHAR_MODE; {*CALL PROCEDURES*}
2 : SEL_CHAR_SET;
3 : SEL_PRN_MODE;
4 : SEL_MODE_COMB;
5 : SEL_CHAR_PITCH;
end {case};
end {while};
end {CHAR_MODE_COMS};
{********************************************************************}
{*PROCEDURE:MAIN_MENU, This is the printer options main menu routine*}
{*and calls all the other printer option menus *}
{********************************************************************}
procedure MAIN_MENU;
begin
WOPEN(setings);
WMTITLE(setings,4,14,'COMMANDS SENT TO PRINTER SINCE LAST RESET');
m1c := 10;
WMTITLE(menu_main,4,14,'COMMANDS MAIN MENU');
while not(m1c in[0,9]) do
begin
m1c := POP_MENU(menu_main,27,8);
case m1c of
1 : CHAR_MODE_COMS; {*CALL PROCEDURES*}
2 : LINE_SPC_COMS;
3 : PAP_FEED_COMS;
4 : PG_FORMAT_COMS;
5 : WD_PROC_COMS;
6 : DATA_CON_COMS;
7 : MISC_COMS;
8 : PRINT;
9 : WMCLOSE(menu_main)
end {case};
end {while};
WMCLOSE(setings);
end {MAIN_MENU};
{**************************************************************************}
{*PROCEDURE:SET_UP_MENUS, This procedure sets up all the option menus reqd*}
{*for the programme Printer.exe *}
{**************************************************************************}
procedure SET_UP_MENUS;
begin
error := NEW_WIN(24,9,56,15,1,4,14,7,12); {*ERROR WINDOW*}
setings := NEW_WIN(1,22,80,25,1,7,1,1,14); {*SETTINGS WINDOW*}
layout := NEW_WIN(41,1,71,11,1,0,15,0,12); {*PAGE LAYOUT WINDOW*}
printing := NEW_WIN(1,12,80,25,1,7,0,0,2); {*TEXT FILE WINDOW*}
colotog := 'G'; {*COLOUR TOGGLE*}
getmem(mt,9*81); {*MAIN MENU (POP)*}
mt^[1] := 'Character Mode Commands';
mt^[2] := 'Line Spacing Commands';
mt^[3] := 'Paper Feed Commands';
mt^[4] := 'Page Format Commands';
mt^[5] := 'Word Processing Commands';
mt^[6] := 'Data Control Commands';
mt^[7] := 'Miscellaneous Commands';
mt^[8] := 'Print Menu';
mt^[9] := 'Quit';
menu_main := NEW_MENU(1,1,14,7,0,9,mt,9);
freemem(mt,9*81);
getmem(mt,5*81); {*MAIN CHARACTER MODE*}
mt^[1] := 'CHAR MODE'; {*MENU (BAR) *}
mt^[2] := 'CHAR SET';
mt^[3] := 'PRINTER MODE';
mt^[4] := 'MODE COMBIN';
mt^[5] := 'CHAR PITCH';
menu_char1 := NEW_MENU(1,1,14,4,14,9,mt,5);
freemem(mt,5*81);
getmem(mtc,5*81); {*BAR MENU COMMENTS*}
mtc^[1] := 'Display Character Mode (User Combination) Selection Menu';
mtc^[2] := 'Display International Character Set Selection Menu';
mtc^[3] := 'Display Printer Mode Selection Menu';
mtc^[4] := 'Display Character Mode (Preset Combination) Selection Menu';
mtc^[5] := 'Display Character Pitch Selection Menu';
MBAR_COMMENT(menu_char1,mtc);
freemem(mt,5*81);
getmem(mt,33*81); {*CHAR MODE COMMANDS*}
mt^[1] := 'Reset (Clear) Printer'; {*SUB MENU 1 (LIST) *}
mt^[2] := 'Set One-Line Double Width Print 1';
mt^[3] := 'Set One-Line Double Width Print 2';
mt^[4] := 'Release One-Line Double Width Prnt';
mt^[5] := 'Set Double Width Printing';
mt^[6] := 'Release All Double Width Settings';
mt^[7] := 'Set Compressed Printing 1';
mt^[8] := 'Set Compressed Printing 2';
mt^[9] := 'Release Compressed or IBM Elite';
mt^[10] := 'Set Double Printing';
mt^[11] := 'Release Double Printing';
mt^[12] := 'Set Emphasis Printing';
mt^[13] := 'Release Emphasis Printing';
mt^[14] := 'Set Pica Pitch';
mt^[15] := 'Set Elite Pitch';
mt^[16] := 'Set Elite Pitch (IBM Mode Only)';
mt^[17] := 'Set NLQ (Pica Pitch) Mode';
mt^[18] := 'Set NLQ (Elite Pitch) Mode';
mt^[19] := 'Set NLQ Font';
mt^[20] := 'Set Draft Font';
mt^[21] := 'Set Superscript Mode';
mt^[22] := 'Set Subscript Mode';
mt^[23] := 'Release Sub/Superscript Mode';
mt^[24] := 'Set Italic Mode';
mt^[25] := 'Release Italic Mode';
mt^[26] := 'Set Italic Int Mode (Std Mode)';
mt^[27] := 'Release Italic Int Mode (Std Mode)';
mt^[28] := 'Set IBM Graphics Mode 1 (IBM Mode)';
mt^[29] := 'Set IBM Graphics Mode 2 (IBM Mode)';
mt^[30] := 'Set Underline Printing';
mt^[31] := 'Release Underline Printing';
mt^[32] := 'Set Proportional Spacing Mode';
mt^[33] := 'Release Proportional Spacing Mode';
menu_char2 := NEW_MENU(1,1,14,7,0,9,mt,33);
freemem(mt,33*81);
getmem(mt,11*81); {*CHAR MODE COMMANDS*}
mt^[1] := '**RESET (CLEAR) PRINTER*'; {*SUB MENU 2 (POP) *}
mt^[2] := '******* U.S.A. *********';
mt^[3] := '******* FRANCE *********';
mt^[4] := '******* ENGLAND ********';
mt^[5] := '******* DENMARK 1 ******';
mt^[6] := '******* DENMARK 2 ******';
mt^[7] := '******* SWEDEN *********';
mt^[8] := '******* ITALY **********';
mt^[9] := '******* SPAIN **********';
mt^[10]:= '******* JAPAN **********';
mt^[11] := '******* NORWAY *********';
menu_set := NEW_MENU(1,1,14,7,0,1,mt,11);
freemem(mt,11*81);
getmem(mt,5*81); {*CHAR MODE COMMANDS*}
mt^[1] := 'Reset (Clear) Printer'; {*SUB MENU 3 (POP) *}
mt^[2] := 'Set Standard Mode ';
mt^[3] := 'Set IBM Matrix Mode';
mt^[4] := 'Set IBM Graphics Mode 1';
mt^[5] := 'Set IBM Graphics Mode 2';
menu_mode := NEW_MENU(1,1,14,7,0,9,mt,5);
freemem(mt,5*81);
getmem(mt,20*81); {*CHAR MODE COMMANDS*}
mt^[1] := 'RESET (CLEAR) PRINTER'; {*SUB MENU 4 (LIST) *}
mt^[2] := 'RESET+ELITE';
mt^[3] := 'RESET+COMPRESSED';
mt^[4] := 'RESET+EMPHASIZED';
mt^[5] := 'RESET+ELITE+EMPH';
mt^[6] := 'RESET+DOUBLE';
mt^[7] := 'RESET+ELITE+DOUBLE';
mt^[8] := 'RESET+COMP+DOUBLE';
mt^[9] := 'RESET+EMPH+DOUBLE';
mt^[10] := 'RESET+ELITE+EMPH+DOUBLE';
mt^[11] := 'RESET+2WID';
mt^[12] := 'RESET+ELITE+2WID';
mt^[13] := 'RESET+COMP+2WID';
mt^[14] := 'RESET+EMPH+2WID';
mt^[15] := 'RESET+ELITE+EMPH+2WID';
mt^[16] := 'RESET+DOUBLE+2WID';
mt^[17] := 'RESET+ELITE+DOUBLE+2WID';
mt^[18] := 'RESET+COMP+DOUBLE+2WID';
mt^[19] := 'RESET+EMPH+DOUBLE+2WID';
mt^[20] := 'RESET+ELITE+EMPH+DOUBLE+2WID';
menu_comb := NEW_MENU(1,1,14,7,0,9,mt,20);
freemem(mt,20*81);
getmem(mt,5*81); {*CHAR MODE COMMANDS*}
mt^[1] := 'Reset (Clear) Printer '; {*SUB MENU 5 (POP) *}
mt^[2] := '10 Characters Per Inch';
mt^[3] := '12 Characters Per Inch';
mt^[4] := '15 Characters Per Inch';
mt^[5] := '17 Characters Per Inch';
menu_pitch := NEW_MENU(1,1,14,7,0,9,mt,5);
freemem(mt,5*81);
getmem(mt,7*81); {*LINE SPACING COMMANDS*}
mt^[1] := 'Reset (Clear) Printer'; {*MENU (POP) *}
mt^[2] := 'Set Line Spacing To 1/8"';
mt^[3] := 'Set Line Spacing To 7/72"';
mt^[4] := 'Set Line Spacing To 1/6"';
mt^[5] := 'Set Line Spacing To n/72"';
mt^[6] := 'Set Line Spacing To n/216"';
mt^[7] := '1-Line Only TO n/216"';
menu_linesp := NEW_MENU(1,1,14,7,0,9,mt,7);
freemem(mt,7*81);
getmem(mt,5*81); {*PAPER FEED COMMANDS*}
mt^[1] := 'Reset (Clear) Printer'; {*MENU (POP) *}
mt^[2] := 'Advance Paper To Next Top Of Form Position';
mt^[3] := 'Advance Paper One Line';
mt^[4] := 'Set Skip Perforation To n Lines';
mt^[5] := 'Release Skip Perforation';
menu_pfeed := NEW_MENU(1,1,14,7,0,9,mt,5);
freemem(mt,5*81);
getmem(mt,16*81); {*PAGE FORMAT COMMANDS*}
mt^[1] := 'Reset (Clear) Printer'; {*MENU (POP) *}
mt^[2] := 'Print, Then Backspace One Character';
mt^[3] := 'Execute Horizontal Tabulation';
mt^[4] := 'Execute Vertical Tabulation';
mt^[5] := 'Set Horizontal Tabs T1..T32';
mt^[6] := 'Release Horizontal Tabs T1..T32';
mt^[7] := 'Set Horizontal Tabulation Every n Columns';
mt^[8] := 'Set Vertical Tabulation T1..T32';
mt^[9] := 'Release Vertical Tabulation T1..T32';
mt^[10] := 'Set Vertical Tabultion Every n Lines';
mt^[11] := 'Set Page Length n In Inches';
mt^[12] := 'Set Page Length To n Lines';
mt^[13] := 'Set Left Margin';
mt^[14] := 'Set Right Margin (Std Mode Only)';
mt^[15] := 'Skip n Columns On a Line';
mt^[16] := 'Skip n Lines';
menu_pgfrmt := NEW_MENU(1,1,14,7,0,9,mt,16);
freemem(mt,16*81);
getmem(mt,5*81); {*WORD PROCESSING COMS*}
mt^[1] := 'Reset (Clear) Printer'; {*MENU (POP) *}
mt^[2] := 'Enable Left Alignment of Each Line';
mt^[3] := 'Enable Auto Centering of Each Line';
mt^[4] := 'Enable Right Alignment of Each Line';
mt^[5] := 'Enable Auto Justification of Each Line';
menu_wproc := NEW_MENU(1,1,14,7,0,9,mt,5);
freemem(mt,5*81);
getmem(mt,9*81); {*DATA CONTROL COMMANDS*}
mt^[1] := 'Reset (Clear) Printer'; {*MENU (POP) *}
mt^[2] := 'Clear All Data In Print Buffer';
mt^[3] := 'Delete Last Printable Character';
mt^[4] := 'Select Printer Remotely';
mt^[5] := 'Deselect Printer Remotely';
mt^[6] := 'Set The MSB On (Most Signif Bit=1)';
mt^[7] := 'Set The MSB Off (Most Signif Bit=0)';
mt^[8] := 'Cancel MSB Setting (Send Byte As Is)';
mt^[9] := 'Deselect Printer Remotely (IBM Mode Only)';
menu_datacon := NEW_MENU(1,1,14,7,0,9,mt,9);
freemem(mt,9*81);
getmem(mt,11*81); {*MISCELLANEOUS COMS*}
mt^[1] := 'Reset (Clear) Printer'; {*MENU (POP) *}
mt^[2] := 'Start Printing';
mt^[3] := 'First Byte Of Multi-Byte Control codes';
mt^[4] := 'Last Byte Of Certain Multi-Byte Control Codes';
mt^[5] := 'Home The Print Head';
mt^[6] := 'Set Half Speed Printing (Quiet Mode)';
mt^[7] := 'Release half Speed Printing (Quiet Mode)';
mt^[8] := 'Set Single Direction Printing';
mt^[9] := 'Release Single Direction Printing';
mt^[10] := 'Enable Paper-End Detection';
mt^[11] := 'Disable Paper-End Detection';
menu_misc := NEW_MENU(1,1,14,7,0,9,mt,11);
freemem(mt,11*81);
getmem(mt,13*81); {*PRINT MENU (POP)*}
mt^[1] := 'FileName Stamping On/Off';
mt^[2] := 'FileDate Stamping On/Off';
mt^[3] := 'FileTime Stamping On/Off';
mt^[4] := 'FileSize Stamping On/Off';
mt^[5] := 'System Date Stamping On/Off';
mt^[6] := 'System Time Stamplig On/Off';
mt^[7] := 'Page Numbering On/Off';
mt^[8] := 'Page Breaking On/Off';
mt^[9] := 'Set Individual Or Global';
mt^[10] := 'Select Global Copies';
mt^[11] := 'Select File(s) To Print';
mt^[12] := 'View Current File List';
mt^[13] := 'Start Printing';
menu_print := NEW_MENU(1,1,14,7,0,9,mt,13);
freemem(mt,13*81);
end {SET_UP_MENUS};
{****************************************************************************}
{*PROCEDURE:MAIN, This is the main procedure it builds most of the menus and*}
{*windows, displays the credits and passes control to MENU_MAIN(). *}
{****************************************************************************}
begin
{ MAUTO_IN := TRUE; }
{ MAUTO_OUT := TRUE;
assign(mout,'\pas\pas\pageprnt');
rewrite(mout);}
assigncrt(scr); {*SET UP FAST TEXT SCR*}
rewrite(scr); {*OPEN IT FOR USE*}
textattr_safe := textattr; {*SAVE TEXT COLOURS*}
textbackground(6); {*BACKGROUND TO RED*}
actionX := 1; {*POSITION IN SET WIND*}
actionY := 1;
files := 0; {*INIT FILES COUNT*}
ncopies := 1; copies := '1'; {*INIT COPIES COUNT*}
plen := 66; {*DEFAULT PAGE LENGTH*}
fname := false; fdate := false; ftime := false; {*INIT FILE FLAGS*}
fsize := false;
sdate := false; stime := false; pgnum := false; {*INIT SYSTEM FLAGS*}
pbreak := false; Icopies := false; {*INIT OTHER FLAGS*}
clrscr;
hello := NEW_WIN(23,9,56,14,1,1,14,7,0);
WOPEN(hello);
writeln(scr,' LOADING "PAGEPRNT.EXE" V1.0 ');
writeln(scr,' A PRINTER SET UP UTILITY BY ');
writeln(scr,' G.R.DYKE (c)01/12/93 ');
SET_UP_MENUS; {*CALL TO SET UP MENUS*}
gotoxy(1,4);
writeln(scr,' "PAGEPRNT.EXE" NOW READY ');
delay(1500);
WMDELETE(hello);
MAIN_MENU; {*CALL MAIN MENU*}
textattr := textattr_safe; {*RESTORE TEXT COLOURS*}
clrscr;
{ close(mout); }
end {MAIN}.